<?php

namespace common\models\tsline;

use Yii;

/**
 * This is the model class for table "{{%ts_dynamic}}".
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property string $model 关联模型
 * @property int $model_id 关联模型id
 * @property string $type 动态类型： active 主动动态 passive 被动动态
 * @property string $content 动态内容
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class TslineDynamic extends \yii\db\ActiveRecord {

    use \common\traits\TimestampBehavior;

    const MODEL_ARTICLE = 'article';

    const TYPE_ACTIVE = 'active';
    const TYPE_PASSIVE = 'passive';

    const STATUS_ON = 1;
    const STATUS_OFF = 0;
    const STATUS_DELETED = -1;
    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%ts_dynamic}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['user_id', 'model_id', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['content'], 'required'],
            [['content'], 'string'],
            [['model', 'type'], 'string', 'max' => 30],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'user_id' => '用户ID',
            'model' => '关联模型',
            'model_id' => '关联模型id',
            'type' => '动态类型： active 主动动态 passive 被动动态',
            'content' => '动态内容',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

}
